﻿/*
Post-Deployment Script Template							
--------------------------------------------------------------------------------------
 This file contains SQL statements that will be appended to the build script.		
 Use SQLCMD syntax to include a file in the post-deployment script.			
 Example:      :r .\myfile.sql								
 Use SQLCMD syntax to reference a variable in the post-deployment script.		
 Example:      :setvar TableName MyTable							
               SELECT * FROM [$(TableName)]					
--------------------------------------------------------------------------------------
*/

-- Actual Data
INSERT INTO [dbo].[ColorSpectrumDefinition] ([Hex]) VALUES
 ('000000')
,('FF0000')
,('FFFF00')
,('FF00FF')
,('00FF00')
,('00FFFF')
,('0000FF')
,('FFFFFF')

-- Anonymous User
SET IDENTITY_INSERT [dbo].[User] ON
INSERT INTO [dbo].[User] ([Id], [Email], [Password], [Nickname]) VALUES (-1, 'anonymous@sir.com', '', 'Anonymous')
SET IDENTITY_INSERT [dbo].[User] OFF

-- Anonymous User Folder
SET IDENTITY_INSERT [dbo].[Folder] ON
INSERT INTO [dbo].[Folder] ([Id], [UserId], [ParentFolderId], [IsPrivate], [IsParentFolderPrivate], [Name]) VALUES (0, -1, 0, 0, 0, 'Anonymous')
SET IDENTITY_INSERT [dbo].[Folder] OFF

-- Patterns
SET IDENTITY_INSERT [dbo].[PatternDescriptionGroup] ON
INSERT INTO [dbo].[PatternDescriptionGroup] ([Id], [Name]) VALUES
 (1, 'Colors')
,(2, 'Theme')
,(3, 'Landscape')
SET IDENTITY_INSERT [dbo].[PatternDescriptionGroup] OFF

SET IDENTITY_INSERT [dbo].[PatternDescription] ON
INSERT INTO [dbo].[PatternDescription] ([Id], [Name], [IconUrl], [PatternDescriptionGroupId]) VALUES
 (1, N'Black', N'black', 1)
,(2, N'Red', N'red', 1)
,(3, N'Magenta', N'magenta', 1)
,(4, N'Blue', N'blue', 1)
,(5, N'Cyan', N'cyan', 1)
,(6, N'Green', N'green', 1)
,(7, N'Yellow', N'yellow', 1)
,(8, N'White', N'white', 1)
,(9, N'Black & White', N'black_white', 2)
,(10, N'Gray Scale', N'grayscale', 2)
,(11, N'Sepia', N'sepia', 2)
,(12, N'Mountains', N'mountains', 3)
,(13, N'Beaches', N'beaches', 3)
,(14, N'Snow', N'snow', 3)
,(15, N'Forest', N'forest', 3)
,(16, N'Sunset', N'sunset', 3)

SET IDENTITY_INSERT [dbo].[PatternDescription] OFF



-- Sample Data
-- Insert User
INSERT INTO [dbo].[User] ([Email], [Password], [Nickname]) VALUES
 ('test@email.com', 'password', 'Test User')
,('testing@sir.com', 'password', 'Testing Account')
,('john@sir.com', 'password', 'John')
,('jane@sir.com', 'password', 'Jane')
,('paul_c@sir.com', 'password', 'Paul C.')
,('matt@sir.com', 'password', 'Matt')
,('paul.w@sir.com', 'password', 'Paul W')
,('dania@sir.com', 'password', 'dania')
,('it@sir.com', 'password', 'IT')
,('admin@sir.com', 'password', 'ADMIN');

INSERT INTO [dbo].[Folder] ([UserId], [ParentFolderId], [IsPrivate], [IsParentFolderPrivate], [Name])
 SELECT [Id], 0, 0, 0, 'Library' FROM [dbo].[User] WHERE [Id] > 0

INSERT INTO [dbo].[Library] ([UserId], [FolderId])
 SELECT [UserId], [Id] FROM [dbo].[Folder]

DECLARE @tempImages TABLE ([Num] INT);
INSERT INTO @tempImages VALUES (1),(2),(3),(4),(5),(6),(7),(8),(9),(10);

INSERT INTO [dbo].[Image]
           ([UserId]
           ,[FolderId]
           ,[Name]
           ,[FileType]
           ,[Size]
           ,[IsPrivate]
		   ,[IsFolderPrivate]
           ,[StatusId]
           ,[Uploaded])
SELECT U.[Id], F.[Id], 'Image - ' + CONVERT(NVARCHAR(10), [Num]), 'JPEG', 1, 1, 0, 0, GETDATE()
FROM @tempImages, [dbo].[User] U, [dbo].[Folder] F
WHERE U.[Email] = 'matt@sir.com' AND F.[UserId] = U.[Id] AND F.[ParentFolderId] = 0
